<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <div id="online_repair_regtb">
        <form id="online_repair_regForm" class="m5">
            学期：
            <select class="form-control1" name="termId" id="termId"></select>
            报修时间：
            <input class="easyui-datebox form-control1" name="startDate" id="startDate"> - <input class="easyui-datebox form-control1" name="endDate" id="endDate">
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="searchForm('online_repair_reg')">查询</a>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm1('online_repair_reg')">重置</a><br/>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="add('online_repair_reg')">新增</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="del('online_repair_reg','/onlineRepair/online_repair_reg')">删除</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="modify('online_repair_reg')">修改</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" onclick="save('online_repair_reg')">保存</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-undo',plain:true" onclick="undo('online_repair_reg')">取消</a>
        </form>
    </div>
    <table id="online_repair_regdg">
        <thead>
            <tr>
                <th data-options="field:'ID',checkbox:true">ID</th>
                <th data-options="field:'学期名称',title:'学期名称'"></th>
                <th data-options="field:'报修人',title:'报修人'"></th>
                <th data-options="field:'联系电话',title:'联系电话'"></th>
                <th data-options="field:'报修类别',title:'报修类别',editor:{type:'combobox',options:{
                    editable:false,
                    required:true,
                    url:'onlineRepair/repair_type_conf/list'}}"></th>
                <th data-options="field:'建筑物',title:'建筑物',editor:{type:'combobox',options:{
                    editable:false,
                    required:true,
                    url:'onlineRepair/repair_building_conf/list',
                    onSelect: buildingFloorList
                }}"></th>
                <th data-options="field:'楼层',title:'楼层',editor:{type:'combobox',options:{
                    editable:false,
                    required:true,
                    url:'onlineRepair/repair_building_conf/buildingFloor?name='}}"></th>
                <th data-options="field:'报修地点',title:'报修地点',editor:{type:'textbox',options:{required:true}}"></th>
                <th data-options="field:'故障描述',title:'故障描述',width:200,editor:{type:'textbox',options:{required:true}},
                formatter: function(value, row, index) {
                    return '<span class=\'note\' title=\''+(value?value:'')+'\'>'+ value + '</span>';
                }"></th>
                <th data-options="field:'报修时间',title:'报修时间'"></th>
                <th data-options="field:'维修状态',title:'维修状态',formatter: function(value, row, index) {
                    if(value == '001') return '待维修';
                    else if(value == '000') return '已维修';
                    else return '';
                }"></th>
                <th data-options="field:'维修回复',title:'维修回复',width:200,
                formatter: function(value, row, index) {
                    return '<span class=\'note\' title=\''+value+'\'>'+ (value?value:'') + '</span>';
                }"></th>
                <th data-options="field:'回复时间',title:'回复时间'"></th>
            </tr>
        </thead>
    </table>

    <script type="text/javascript">
        $(function(){
            var url = "/onlineRepair/online_repair_reg";
            initDatagrid("online_repair_reg",url);
            termList("online_repair_reg");
        })  
        function buildingFloorList(record){
            var url="onlineRepair/repair_building_conf/buildingFloor?name=" + record.value;
            var ed=$('#online_repair_regdg').datagrid('getEditor',{index:dgEditIndex['online_repair_reg'],field:'楼层'});
            var row = $('#online_repair_regdg').datagrid("getSelections")[0];
            $(ed.target).combobox('setValue', row ? row.楼层 : "");
            $(ed.target).combobox('reload',url);
        }
        function resetForm1(cf){
            $("#" + cf + "Form")[0].reset();
            $("#" + cf + "Form #startDate").datebox('setValue', null);
            $("#" + cf + "Form #endDate").datebox('setValue', null);
        }
    </script>
</body>
</html>